<!--
 * @Author: Rain
 * @Date: 2024/01/10 22:11:13
 * @LastEditTime: 2024-01-16 14:50:13
 * @Description: Do Something
-->
<template>
  <div class="app-container w-full h-full overflow-hidden flex flex-col">
    <!--工具栏-->
    <div
      class="head-container head-container overflow-hidden w-full flex flex-col"
    >
      <div class="flex items-center flex-end search pb-10">
        <!-- 搜索 -->
        <label class="el-form-item-label">申请时间</label>
        <el-date-picker
          v-model="query.applyTime"
          type="daterange"
          placeholder="申请时间"
          value-format="yyyy-MM-dd"
          range-separator="至"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
        />
        <rrOperation :crud="crud" />
      </div>
    </div>
    <!--表格渲染-->
    <div class="w-full flex-1 overflow-hidden">
      <el-table
        ref="table"
        v-loading="crud.loading"
        :data="crud.data"
        size="small"
        style="width: 100%"
      >
        <el-table-column prop="applyType" label="名称">
          <template slot-scope="{ row }">
            {{
              row.applyType * 1 === 1
                ? "身份绑定课程"
                : row.applyType * 1 === 2
                  ? "身份产品分润变更"
                  : row.applyType * 1 === 3
                    ? "门票数量变更"
                    : row.applyType * 1 === 4
                      ? "初始门票设置"
                      : row.applyType * 1 === 5
                        ? "从属关系变更"
                        : "身份变更"
            }}
          </template>
        </el-table-column>
        <el-table-column prop="applyUser" label="申请人" />
        <el-table-column prop="createTime" label="提交时间" />
        <el-table-column prop="applyStatus" label="状态" width="60px">
          <template slot-scope="{ row }">
            {{
              row.applyStatus === 0
                ? "驳回"
                : row.applyStatus * 1 === 1
                  ? "通过"
                  : "待审批"
            }}
          </template>
        </el-table-column>
      </el-table>
    </div>
    <pagination />
  </div>
</template>

<script>
import crudDisChangeApply from '@/api/disChangeApply'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import pagination from '@crud/Pagination'
import store from '@/store'

const defaultForm = {
  applyId: null,
  applyType: null,
  applyTypeDesc: null,
  applyUser: null,
  createTime: null,
  updateTime: null,
  updateUser: null,
  applyStatus: null,
  refuseMsg: null,
  mirrorImage: null,
  applyContent: null
}
export default {
  name: 'DisChangeApply',
  components: { pagination, rrOperation },
  mixins: [presenter(), header(), form(defaultForm), crud()],
  cruds() {
    return CRUD({
      title: '我的申请工单',
      url: `api/disChangeApply`,
      idField: 'applyId',
      sort: 'applyId,desc',
      query: {
        applyUser: store.state.user.user.username
      },
      crudMethod: { ...crudDisChangeApply },
      optShow: {
        add: false,
        del: false,
        reset: true,
        upload: false
      }
    })
  },
  data() {
    return {
      rules: {},
      queryTypeOptions: [
        { key: 'applyTime', display_name: '申请时间' }
      ]
    }
  },
  computed: {

  },
  mounted() {

  },
  methods: {
  }
}
</script>

<style scoped></style>

